
import { app, ipcMain, Notification } from 'electron';
import Logger from 'electron-log';


export class NotificationServices {

    constructor() {
    }

    public async show({ title, body }: any): Promise<void> {
        Logger.info(`Notification: ${title} - ${body}`);
        const notification = new Notification({ title, body });
        notification.show();
    }

}


// 保持原有的IPC注册逻辑不变
export function registerNotificationIPC(service: NotificationServices) {
    ipcMain.handle('notification:show', (_, { title, body }: any) => service.show({ title, body }));
}

// 保持原有的单例导出方式不变
export const notificationServices = new NotificationServices();
